﻿using DocumentBuilder.Components;

namespace DocumentBuilder.Controls.DataSources.Collection
{
    public class ObjectDataItem : IDataItem
    {
        public readonly int DataIndex;
        public readonly ViewObject Data;

        public ObjectDataItem(int dataIndex, ViewObject data)
        {
            this.DataIndex = dataIndex;
            this.Data = data;
        }

        #region IDataItem Members

        public string Eval(string evalPath)
        {
            if (Data[evalPath] != null)
                return Data[evalPath].FormattedValue;
            else
                return "";
        }

        #endregion
    }
}